﻿@model IEnumerable<Developer.Entity.RepairProblem>

@{
    ViewBag.Title = "SelectModel";
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="~/Content/UI/css/getprice.min.css" />
    <link rel="stylesheet" href="~/Content/UI/css/mui.min.css" />

</head>

<body>
    <div class="mui-card">
        <h4 style="color:#90909c;margin:15px;">@ViewBag.device</h4>
    </div>
    <form action="/fix/getprice?mid=@Model.FirstOrDefault().RepairColorId" method="post" id="getprice">
        <div>
            <div class="mui-card">
                <ul class="mui-table-view mui-table-view-chevron">

                    @{
                        var i = 1;
                        var j = 1;
                        foreach (var item in Model.OrderBy(a=>a.Sequence))
                        {
                            if (item.Name.Contains("（") || item.Name.Contains("("))
                            {

                                <li class="mui-table-view-cell mui-collapse">
                                    <a class="mui-navigate-right">@item.Name</a>
                                    <ul class="mui-table-view mui-table-view-chevron">

                                        @foreach (var detail in item.RepairProblemDetail.OrderBy(a=>a.Sequence))
                                        {
                                            <li class="mui-table-view-cell" style="padding-right:34px;padding:7px 15px;">
                                                <div class="mui-input-row mui-checkbox mui-left">
                                                    <label>
                                                        @detail.Name
                                                        <span style="float:right;">@detail.Price￥</span>
                                                    </label>
                                                    <input name="checkbox@(j++)" type="checkbox" value="@detail.Price" />
                                                </div>
                                            </li>
                                        }

                                    </ul>
                                </li>

                            }
                            else
                            {

                                <li class="mui-table-view-cell mui-collapse">
                                    <a class="mui-navigate-right">@item.Name</a>
                                    <ul class="mui-table-view mui-table-view-chevron">

                                        @foreach (var detail in item.RepairProblemDetail.OrderBy(a => a.Sequence))
                                        {
                                            <li class="mui-table-view-cell" style="padding-right:34px;padding:7px 15px;">
                                                <div class="mui-input-row mui-radio mui-left">
                                                    <label>
                                                        @detail.Name
                                                        <span style="float:right;">@detail.Price￥</span>
                                                    </label>
                                                    <input name="radio@(i)" type="radio" value="@detail.Price" />
                                                </div>
                                            </li>
                                        }
                                        @{i++;
                                        }
                                    </ul>
                                </li>



                                                }
                                            }
                    }
                </ul>
            </div>
        </div>
        <input id="radioval" value="" type="hidden" name="totalProblem" />
        <div class="mdui-col-md-12" style="width:100%">
            <div class="sure-order">
                <button type="submit" class="sure-order-button" onclick="getradio()">提交</button>
            </div>
        </div>
    </form>



    <script src="~/Content/UI/js/mui.min.js"></script>
    <script type="text/javascript">

        function getradio() {
            var detail = $('#radioval').val();
            $('input:radio:checked').each(function (i, val) {
                detail += val.title + ",";
            });
            $('input:checkbox:checked').each(function (i, val) {
                detail += val.title + ",";
            });
            $('#radioval').val(detail);
            //$('#getprice').submit();
        }
        function batdel(url) {
            var checkedArr = new Array();
            $("input:checkbox[name=checkbox]:checked")
                .each(function () {
                    checkedArr.push($(this).val());
                });
            if (checkedArr.length < 1) {
                layer.msg("请选择要删除的项", { time: 2000 });
            } else {
                layer.confirm("确认要删除吗？", function () {
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: { 'ids': checkedArr },
                        success: function () {
                            location.replace(location.href);
                        },
                        error: function (msg) {
                            layer.msg(msg, { time: 1000 });
                        }
                    });
                });
            }

        }
    </script>
</body>
</html>